package com.alks.function.controller;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.DarkLock;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.service.IDarkDoorService;
import com.alks.function.service.biocontrol.factoryQuery.IStkAccService;
import com.alks.function.service.stockdept.pcfactorystockquery.IReciveMtlService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author MS
 * @since 2024/11/8下午4:29
 */
@RestController
@ApiRestController("/darkDoor")
@Api(value = "后门接口", tags = "后门接口")
@Slf4j
public class DarkDoorController {

    @Autowired
    private IStkAccService stkAccService;
    @Autowired
    private IReciveMtlService drawService;
    @Autowired
    private IDarkDoorService service;

    @WebLogger
    @DarkLock(password = "123")
    @GetMapping("/stkAcc/update/forced")
    @ApiOperation(value = "账目库存强制同步", tags = "后门接口")
    public ResponseInfo stkAccUpdateForced(@RequestParam(required = false) Integer day) {
        stkAccService.updateForced(day,1);
        return ResponseInfo.ok();
    }

    @WebLogger
    @DarkLock(password = "486*")
    @GetMapping("/draw/rollBack")
    @ApiOperation(value = "重复请领发料数据重整", tags = "后门接口")
    public ResponseInfo drawRollBack() {
        drawService.drawRollBack();
        return ResponseInfo.ok();
    }


    @WebLogger
    @DarkLock(password = "486*")
    @GetMapping("/mtlAcc/reUp")
    @ApiOperation(value = "库存重整", tags = "后门接口")
    public ResponseInfo accUp() {
        service.accUp();
        return ResponseInfo.ok();
    }

    @WebLogger
    @DarkLock(password = "486*")
    @GetMapping("/finance/balance")
    @ApiOperation(value = "财务结算单号刷新", tags = "后门接口")
    public ResponseInfo finance() {
        service.finance();
        return ResponseInfo.ok();
    }



}